//
//  ViewController.m
//  MoviePlayer
//
//  Created by Justsoso on 16/4/5.
//  Copyright © 2016年 Justsoso. All rights reserved.
//

#import "ViewController.h"

#import <MediaPlayer/MediaPlayer.h>

@interface ViewController ()

@property (nonatomic,strong) MPMoviePlayerViewController *moviePlayerVC;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)btnPressed:(id)sender
{
    NSURL *fileURL = [[NSBundle mainBundle] URLForResource:@"background" withExtension:@"mov"];
    
    // 1. 弹出方式
    self.moviePlayerVC = [[MPMoviePlayerViewController alloc] initWithContentURL:fileURL];
    
    self.moviePlayerVC.moviePlayer.controlStyle = MPMovieControlStyleFullscreen;
    
    self.moviePlayerVC.moviePlayer.scalingMode = MPMovieScalingModeFill;
    
    [self presentMoviePlayerViewControllerAnimated:self.moviePlayerVC];
    
    [self.moviePlayerVC.moviePlayer play];
}

@end
